{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "#load data from file导入txt数据\n",
    "def load_data(filename):\n",
    "    dataset = []\n",
    "    label = []\n",
    "    file = open(filename)\n",
    "    for line in file.readlines():\n",
    "        lineArr = line.strip().split('\\t')\n",
    "        dataset.append(lineArr[0:2])\n",
    "        label.append(lineArr[-1])    \n",
    "    return np.array(dataset,dtype=np.float64),\\\n",
    "           np.array(label,dtype=np.int).reshape(-1,1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100L, 2L) (100L, 1L)\n[ -0.017612  14.053064] [0]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+wXHWZ5/H3EwITggxIiIIJyYWBZQVGo7ki41qsP2Y0\npKiwTs1OQaW0WJxK4cImgFUKk10S3aUKh51AWKzBLFqOmwjr1E4WiuWHaFmDU47KDRswBhGUADcy\nEqMgs5EVcp/945zenNs53X1O9/nxPac/r6que0/36e6nu+89T5/v8/1h7o6IiEhWc+oOQEREmkWJ\nQ0REclHiEBGRXJQ4REQkFyUOERHJRYlDRERyUeIQEZFclDhERCQXJQ4REcllbt0BlOHEE0/0iYmJ\nusMQEWmMHTt2/MLdF2bZt5WJY2JigqmpqbrDEBFpDDN7Nuu+aqoSEZFclDhERCSX0hOHmX3JzF40\ns12J6zaa2V4z2xlfVva47woze9LMnjaza8uOVUREBquixvFl4DbgK13X3+zu/7nXnczsCODzwB8B\n08AjZnaPu+8eJojXXnuN6elpXn311WHuXol58+axePFijjzyyLpDERHpqfTE4e4Pm9nEEHc9F3ja\n3X8KYGZ3ARcBQyWO6elpjj32WCYmJ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Ms\nIoVR4hApzxeA/0A0Rf7nao5FpDBqqhIpgZl9DHjN3b8arxv+HTP7APAZ4J8Db4hn5/24uwc5M69I\nL5odV0REclFTlYiI5KLEISIiuShxiIhILkocIiKSixKHiIjkosQhIiK5KHGIiEguShwiIpLL/wNT\ndObKzIkl8wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x76e4a58>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "#导入数据并且可视化一下\n",
    "x,y = load_data(\"logistic/testSet.txt\")\n",
    "print x.shape,y.shape\n",
    "print x[0],y[0]\n",
    "\n",
    "label1 = np.where(y.ravel() == 0)\n",
    "plt.scatter(x[label1,0],x[label1,1],marker='x',color = 'r',label = '0')\n",
    "label2 = np.where(y.ravel() == 1)\n",
    "plt.scatter(x[label2,0],x[label2,1],marker='o',color = 'b',label = '1')\n",
    "    \n",
    "plt.xlabel('x1')\n",
    "plt.ylabel('x2')\n",
    "plt.legend(loc = 'upper left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#使用batch gradient descent求得最佳参数\n",
    "\n",
    "def sigmoid(x):\n",
    "    return 1.0 / (1+np.exp(-x))\n",
    "#每次使用全部的数据集去更新一次参数\n",
    "def bgd(x,y,learn_rate = 0.001,iters=1000):\n",
    "    m,n = x.shape\n",
    "    weight = np.zeros((n,1)) #初始化为0，是可以的,书上是全部为1\n",
    "    weights = np.zeros((iters,n)) #记录每次weight的变化\n",
    "    \n",
    "    for i in xrange(iters):\n",
    "        out = sigmoid(x.dot(weight))\n",
    "        error = y - out\n",
    "        dw = -x.T.dot(error)\n",
    "        weight += -learn_rate*dw\n",
    "        weights[i,:] = weight.ravel().T\n",
    "    \n",
    "    return weight,weights\n",
    "\n",
    "\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100L, 3L)\n[[ 5.30867192]\n [ 0.57605434]\n [-0.76684822]]\n(1000L, 3L)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+wXHWZ5/H3QwITgwgSQDA/boKwKDAaJaIzaynqjMYs\nFXRrdipUyhkWt1JMgQlhphyZ1JLgLlU4zgphsUazaIGTK8xsjQjF8kO0dJgpRyCwAUMARZLAzTAS\noyBTkRXuffaP003O7ZzT95zu8+N7+nxeVV035/Tp7u/tvjlPn+f5/jB3R0REJKvD6m6AiIg0iwKH\niIjkosAhIiK5KHCIiEguChwiIpKLAoeIiOSiwCEiIrkocIiISC4KHCIiksvsuhtQhuOOO84XL15c\ndzNERBrjoYce+rm7H5/l2JEMHIsXL2bbtm11N0NEpDHMbE/WY5WqEhGRXBQ4REQkl9IDh5l9zcye\nN7MdsX2bzGyvmW3v3FakPHa5mT1pZk+Z2WfLbquIiMysihrHjcD1wNd79l/j7n+V9iAzmwV8Cfh9\nYAJ40Mxud/edgzTilVdeYWJigpdffnmQh1dizpw5LFiwgMMPP7zupoiIpCo9cLj7fWa2eICHng08\n5e5PA5jZLcB5wECBY2JigqOOOorFixdjZoM8Rancnf379zMxMcGSJUvqbo6MKneI//33botkUGeN\n49Nm9mgnlfXGhPvnA8/Gtic6+wby8ssvM2/evCCDBoCZMW/evKCviKThNm2C9eujYAHRz/Xro/0i\nOdQVOP4aOBlYCjwH/I9hn9DM1pjZNjPbtm/fvrRjhn2ZUoXePmkwd3jhBdi8+WDwWL8+2n7hhYPB\nRCSDWsZxuPvPuv82s/8F3JFw2F5gYWx7QWdf2nNuAbYALFu2TP8LROLM4Jpron9v3hzdANati/br\nS4vkUMsVh5mdFNv8BLAj4bAHgVPNbImZHQGsAm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EBGRXBQ4REQkFwUOERHJRYFDRERyUeAQqZCZ3W1mL5hZ6V0mRcqiwCFSrS8QjREQ\naSwFDpESmNm7O+uOzDGzIztrJZzp7t8FXqq7fSLDaO1cVSJlcvcHzex24L8DrwO2lj3xnEhVFDhE\nyvM5omkgXgbW1twWkcIoVSVSnnnA64nm55pTc1tECqPAIVKerwD/lWi6+8/X3BaRwihVJVICM/sj\n4BV3/0ZnffAfmNmHgCuBtwKv78y++yl3D2rmXZGZaHZcERHJRakqERHJRYFDRERyUeAQEZFcFDhE\nRCQXBQ4REclFgUNERHJR4BARkVwUOEREJJf/D4xnOzx1tbrtAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fac5c0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#现在我们测试一下\n",
    "#首先对x加上x0 =1\n",
    "m,n = x.shape\n",
    "X = np.hstack((np.ones((m,1)),x))\n",
    "print X.shape\n",
    "\n",
    "weight,weights = bgd(X,y)\n",
    "print weight\n",
    "print weights.shape\n",
    "\n",
    "#并且可视化一下最佳参数的效果\n",
    "label1 = np.where(y.ravel() == 0)\n",
    "plt.scatter(x[label1,0],x[label1,1],marker='x',color = 'r',label = '0')\n",
    "label2 = np.where(y.ravel() == 1)\n",
    "plt.scatter(x[label2,0],x[label2,1],marker='o',color = 'b',label = '1')\n",
    "xx = np.arange(-4.0,3.0,0.1)\n",
    "yy = (-weight[0] - weight[1]*xx) / weight[2]\n",
    "plt.plot(xx,yy,\"y_\")\n",
    "plt.xlabel('x1')\n",
    "plt.ylabel('x2')\n",
    "plt.legend(loc = 'upper left')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEKCAYAAAASByJ7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJRE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BqX2e57tt454xJg4nDH5nrf2T\n23zU3YzEfaxx2yPh53ApcJMxpgxn199VxpiHiex1Pgwcttauc5//EScgInmd3wkctNbWWmsDwJ+A\nS4jsde5xtutY6c73bx+SaAiE9cAsY0yRMcYPfAh42uOazpl7JMEvgV3W2u/0eelp4OPu/MeBp/q0\nf8gYE2+MKQJm4QxGjRvW2nuttfnW2kKcf8eXrbUfI7LX+QhQYYwpdpuuBnYSweuMs6voYmNMkvt7\nfjXOGFkkr3OPs1pHd/dSszHmYvdndXuf95w9r0faR2MCrsc5Cmc/zv0YPK9pGNbpHTibk1uBze50\nPZAFvATsBf4KZPZ5z33uz6CUczgSYSxMwBUcP8oootcZWAhscP+t/w/IiIJ1/g9gN87tdn+Lc3RN\nRK0z8CjOGEkAZ0vwzqGsI1Di/pz2Az/CPeF4KJPOVBYRESA6dhmJiMggKBBERARQIIiIiEuBICIi\ngAJBRERcCgSR0zDG/M19LDTGfMTrekRGkgJB5DSstZe4s4XAWQWCe2E2kXFDgSByGsaYVnf2v4Hl\nxpjN7rX6fcaYbxpj1htjthpj/t5d/gpjzGvGmKeBncaYZGPMs8aYLe61/T/o2cqInIH+ghEZnC8D\nX7DW3ghgjFmBcxXOxcaYeOANY8wqd9lFwAXW2oPGmFuBKmvtDe770r0oXmQwtIUgMjTXArcbYzbj\nXHY8C+f6MuBcY+agO78NuMYY8w1jzHJrbZMHtYoMigJBZGgM8E/W2oXuVGSda/aDc4lqAKy1e3C2\nGLYB/2WM+aoHtYoMigJBZHBacG5V2uMvwF3uJcgxxsx2b1xzAmPMZKDdWvsw8E2ccBAZkzSGIDI4\nW4GQMWYL8Gvg+zhHHm1yLztcy8C3LpwHfNMYE8a5quVdo1KtyBDoaqciIgJol5GIiLgUCCIiAigQ\nRETEpUAQERFAgSAiIi4FgoiIAAoEERFxKRBERASA/wf+FbrODC1I7QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x6030668>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#来看看参数weight的随着迭代次数的收敛情况\n",
    "plt.plot(weights)\n",
    "plt.ylabel(\"w0-2\")\n",
    "plt.xlabel(\"iters\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#使用随机梯度下降法更新权重系数\n",
    "def sgd(x,y,learn_rate = 0.01,iters = 200):\n",
    "    m,n = x.shape\n",
    "    weight = np.zeros((n,1))\n",
    "    weight0 = []\n",
    "    weight1 = []\n",
    "    weight2 = []\n",
    "    for i in xrange(iters):\n",
    "        for j in xrange(m):\n",
    "            #每次选取一个样本更新weight,书上是随机选取一个，而不是按照顺序（消除周期性的波动，而是随机的波动）\n",
    "            #书上还有学习率随迭代次数下降,不过我觉得没有必要,因为模型和数据简单，而且下降的方法不通用\n",
    "            out = sigmoid(x[j,:].reshape(1,-1).dot(weight))\n",
    "            error = y[j,:].reshape(1,-1) - out\n",
    "            dw = -x[j,:].reshape(1,-1).T.dot(error)\n",
    "            weight += -learn_rate*dw\n",
    "            weight0.append(weight[0,0])\n",
    "            weight1.append(weight[1,0])\n",
    "            weight2.append(weight[2,0])\n",
    "    return weight,weight0,weight1,weight2\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 7.03803009]\n [ 0.71084578]\n [-1.0395157 ]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+QXXWZ5/H3QwITo2yQEATzozsIiwKjUVp0di0FnVFI\nUVG3ZqeguhwQt1JMgQkwU45MaknDLlU47ghhsUazyICTFma2RoRi+SFaOMyUIxJYwBBAkSTQGUZi\nFMSKrND97B/nXnL65p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Zt4VmYtmxxURkVyUqhIR\nkVwUOEREJBcFDhERyUWBQ0REclHgEBGRXBQ4REQkFwUOERHJRYFDRERy+f8NO+IL19LNsgAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x87dfcc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "weights,weight0,weight1,weight2 = sgd(X,y)\n",
    "print weights\n",
    "\n",
    "#并且可视化一下最佳参数的效果\n",
    "label1 = np.where(y.ravel() == 0)\n",
    "plt.scatter(x[label1,0],x[label1,1],marker='x',color = 'r',label = '0')\n",
    "label2 = np.where(y.ravel() == 1)\n",
    "plt.scatter(x[label2,0],x[label2,1],marker='o',color = 'b',label = '1')\n",
    "xx = np.arange(-4.0,3.0,0.1)\n",
    "yy = (-weights[0] - weights[1]*xx) / weights[2]\n",
    "plt.plot(xx,yy,\"y_\")\n",
    "plt.xlabel('x1')\n",
    "plt.ylabel('x2')\n",
    "plt.legend(loc = 'upper left')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8HOWV6P3fUWu1JFu2ZcubbHlfMJs3lsEsISw2YSDL\nTEyGEEJmPCQhy+TyZsjk/SRMJpkLYcgbwvACDuN7IQnBNwkkJCExy4AhgLHlDW94lxdZtmzLsraW\nWlKf+8dTsttCstRSd1d363w/n/6ourq66ri6XaefpZ5HVBVjjDGmtzL8DsAYY0xqscRhjDEmKpY4\njDHGRMUShzHGmKhY4jDGGBMVSxzGGGOiYonDGGNMVCxxGGOMiYolDmOMMVHJ9DuAeCguLtaysjK/\nwzDGmJSxbt2646o6ojfbpmXiKCsro7y83O8wjDEmZYjI/t5um5aJwxhj0pEq1NV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OjVR1J64Eshn4voh8x4dYjekVSxzG\nxFY9brrPDiuBL3rDZCMi07xRh88iImOAJlX9OfAQLokYk5SsjcOY2HofaBeRTbhRVh/B9bRa7w1t\nfYyup6o9H3hIRMK40Vq/mJBojekDGx3XGGNMVKyqyhhjTFQscRhjjImKJQ5jjDFRscRhjDEmKpY4\njDHGRMUShzHGmKhY4jDGGBMVSxzGGGOi8n8Bc9RaIim4uQIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7b57c18>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#来看看参数weight的随着迭代次数的收敛情况,可以看到有上下波动的情况，但是整体还是逐渐收敛的\n",
    "plt.subplot(311)\n",
    "plt.plot(weight0,\"b\")\n",
    "plt.ylabel(\"w0\")\n",
    "\n",
    "plt.subplot(312)\n",
    "plt.plot(weight1,\"r\")\n",
    "plt.ylabel(\"w1\")\n",
    "\n",
    "plt.subplot(313)\n",
    "plt.plot(weight2,\"y\")\n",
    "plt.ylabel(\"w2\")\n",
    "plt.xlabel(\"iters\")\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "should be 0 and 1\n[[0]\n [1]]\n"
     ]
    }
   ],
   "source": [
    "#处理数据中的缺失值的方法\n",
    "#1.使用可用特征的均值来填补缺失值\n",
    "#2.使用特殊值 0 或者 -1\n",
    "#3.忽略缺失值的样本\n",
    "#4.使用相似样本的均值\n",
    "#5.使用另外的机器学习算法来预测缺失的值\n",
    "\n",
    "#最后补一个预测函数\n",
    "def predict(x,weight):\n",
    "    m = x.shape[0]\n",
    "    x = np.hstack((np.ones((m,1)),x)) #添加x0 = 1\n",
    "    out = sigmoid(x.dot(weight))\n",
    "    pred = np.where(out>0.5,1,0)\n",
    "    return pred\n",
    "\n",
    "input = np.array([[-0.01,14.0],[-1.3,4.6]])\n",
    "pred = predict(input,weight)\n",
    "print \"should be 0 and 1\"\n",
    "print pred\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
